/*
 * @Description  : 工程列表结果模型
 * @Date         : 2021-04-14 09:53:12
 * @Author       : 保锋
 * @LastEditTime : 2021-05-23 14:11:36
 * @LastEditors  : 保锋
 * @FilePath     : \caiying_flutter\lib\model\projectItem_model.dart
 */
import 'package:get/get_rx/src/rx_types/rx_types.dart';
import 'package:yinshui_caiying/model/image_model.dart';

class ProjectListResultModel {
  late int code;
  late String message;
  late Content content;

  ProjectListResultModel(
      {required this.code, required this.message, required this.content});

  ProjectListResultModel.fromJson(Map<String, dynamic> json) {
    code = json['code'];
    message = json['message'];
    content = (json['content'] != null
        ? new Content.fromJson(json['content'])
        : null)!;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['code'] = this.code;
    data['message'] = this.message;
    if (this.content != null) {
      data['content'] = this.content.toJson();
    }
    return data;
  }
}

class Content {
  late int total;
  late int page;
  late int perPage;
  late List<ProjectItemModel> data;

  Content(
      {required this.total,
      required this.page,
      required this.perPage,
      required this.data});

  Content.fromJson(Map<String, dynamic> json) {
    total = json['total'];
    page = json['page'];
    perPage = json['per_page'];
    if (json['data'] != null) {
      data = <ProjectItemModel>[];
      json['data'].forEach((v) {
        data.add(new ProjectItemModel.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['total'] = this.total;
    data['page'] = this.page;
    data['per_page'] = this.perPage;
    if (this.data != null) {
      data['data'] = this.data.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

///工程项目模型
///
///[id]工程id
///
///[name]工程名称
///
///[pjtName]工程类型名称
///
///[pjtId]工程类型id
///
///[longitude]经度
///
///[latitude]纬度
///
///[adName]所属地名称
///
///[adId]所属地Id
///
///[ziduan1]井眼深度
///
///[ziduan2]井眼直径
///
///[ziduan3]井眼内径
///
///[ziduan4]未知
///
///[imageList]图片列表
///
///[meterNum]水表数量
class ProjectItemModel {
  ///工程id
  late int id;

  ///工程名称
  late String name;

  ///工程类型名称
  late String pjtName;

  ///经度
  late double longitude;

  ///纬度
  late double latitude;

  ///所属区划名称
  late String adName;

  ///所属区划id
  late int adId;

  ///井眼深度
  late String ziduan1;

  ///井眼直径
  late String ziduan2;

  ///井眼内径
  late String ziduan3;

  ///未知
  late String ziduan4;

  ///工程类型id
  late int pjtId;

  ///水表数量
  late int meterNum;

  ///图片列表
  final imageList = <ImageModel>[].obs;
  ProjectItemModel(
      {required this.id,
      required this.name,
      required this.pjtName,
      required this.pjtId,
      required this.longitude,
      required this.latitude,
      required this.adName,
      required this.adId,
      required this.ziduan1,
      required this.ziduan2,
      required this.ziduan3,
      required this.ziduan4,
      required this.meterNum});

  ProjectItemModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    pjtName = json['pjt_name'];
    pjtId = json['pjt_id'];
    longitude = json['longitude'];
    latitude = json['latitude'];
    adName = json['ad_name'];
    adId = json['ad_id'];
    ziduan1 = json['ziduan1'];
    ziduan2 = json['ziduan2'];
    ziduan3 = json['ziduan3'];
    ziduan4 = json['ziduan4'];
    meterNum = json['num'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['pjt_name'] = this.pjtName;
    data['longitude'] = this.longitude;
    data['latitude'] = this.latitude;
    data['ad_name'] = this.adName;
    data['ziduan1'] = this.ziduan1;
    data['ziduan2'] = this.ziduan2;
    data['ziduan3'] = this.ziduan3;
    data['ziduan4'] = this.ziduan4;
    return data;
  }
}
